import SvgIcon from "@/components/SvgIcon/index.vue";
import Pagination from "@/components/Pagination/index.vue";
// 全局注册 icon
import * as ElementPlusIconsVue from "@element-plus/icons-vue";

import type { App, Component } from "vue";

const globalComponents: { [name: string]: Component } = { SvgIcon, Pagination };

export default {
  install(app: App) {
    // 注册全局组件
    Object.keys(globalComponents).forEach((key: string) => {
      app.component(key, globalComponents[key]);
    });
    // 注册 ElementPlus 图标
    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
      app.component(key, component);
    }
  },
};
